Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wmic): add gwmi command to be compatible with deleted wmic #143

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

aliuq
Copy link

@aliuq aliuq commented Feb 22, 2022

Q A
Branch? main
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #124
License MIT
Doc PR no

@simonepri
Copy link
Collaborator

simonepri commented Jun 4, 2022

Hi @aliuq, thanks for the PR and sorry for the late reply
I can help reviewing this but I think we should wait for @soyuka to submit (although I also have the permissions to do so in case we don't get any answer).

On a side note,
would you mind porting this also to the very closely related simonepri/pidtree (https://github.com/simonepri/pidtree/blob/main/lib/wmic.js)?
Thanks!!

Comment on lines +56 to +62
try {
spawn('wmic', function (err) {
if (err) throw new Error(err)
})
} catch (err) {
fn = gwmi
}
Copy link
Owner

@soyuka soyuka Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this, isn't there another way to try and see if wmic is installed? I'd even say that we should check if gwmi exists and use it if possible (wmic is old).

Copy link

@paescuj paescuj Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this PR still wants to be pursued, but leaving a comment in any case:

On Windows there's the where 1 command (~ equivalent to UNIX which). This could be used to check whether gwmi / wmic is available.
Though, this still requires a spawn call.

Footnotes

  1. https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/where

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to be able to continue, but I haven't been following this for a long time and have been a little busy lately with my new job, so I may tackle this again in the next two weeks!

### 3.0.1

- fix wmic removed on Windows 11 and add gwmi support

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, I'll suggest however to target a 4.x as its a new feature and we follow semver. I'll merge some pending patches but I'd love to see this being added, many thanks for the work!

P.S.: I had a windows environment at the time of coding the first version but now I don't anymore so its hard for me to test this.

@jalmarverbraak
Copy link

is there any update on when this will be implemented, as i would like to use this in windows 11 which doesn't support wmic any more

@soyuka
Copy link
Owner

soyuka commented Nov 7, 2024

freel free to take it over I think that this is a good base but it needs more testing and some code review, you can open a new pr if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does wmic is required on windows?
6 participants